/**
 * ...
 * @author Krzysztof Rozalski
 */

package hapi.util.profiler;

class NumericalStat {
	
	public var count(default,null):Int;
	public var min(default, null):Float;
	public var max(default, null):Float;
	public var avg(getAvg, null):Float;
	public var sum(default, null):Float;

	public function new() {
		this.min = Math.POSITIVE_INFINITY;
		this.max = this.avg = 0.0;
		this.sum = this.count = 0;
	}
	
	public function update(value:Float):Void {
		++count;
		sum += value;
		if ( value > max ) max = value;
		if ( value < min ) min = value;
	}
	
	function getAvg() {
		return sum / count;
	}
}